#pragma once

#include "Reflection/Property.h"

class CNativeFieldProperty;

class CNativeFieldGetSet : public INonStaticProperty 
{
public:
	CNativeFieldGetSet(CNativeFieldProperty* InFieldProperty);

	virtual CAny GetValue(const void * InObjectPtr) override;
	virtual void SetValue(void * InObjectPtr,const CAny& InValue) override;

protected:
	CNativeFieldProperty* FieldProperty;

};

class CNativeFieldGetPointer : public IFieldProperty
{
public:
	CNativeFieldGetPointer(CNativeFieldProperty* InFieldProperty);

	const void* GetValuePointer(const void* InObjectPtr) override;
	void* GetValuePointer(void* InObjectPtr) override;
	uint32_t GetFieldIndex() override;

	//is this a static field property
	bool IsStatic() override
	{
		//do not support static field for native type now
		return false;
	}

	//get static field value address
	void* GetStaticValuePointer() override
	{
		assert(false&& "do not support static field for native type now");
		return nullptr;
	}

protected:
	CNativeFieldProperty* FieldProperty;
};



// property that is a member variable of a struct or class
class WHENGINE_API CNativeFieldProperty : public CProperty
{
public:	
	CNativeFieldProperty(
		CPropertyList* InParentList
		, TMap<EPropertyFlags,  SReflectionMetaDataValue> InMetaData
		, const SDecoratedType& InType
		, CString InName
		, uint64_t InOffset
		, uint32_t InFieldIndex
		);


	virtual int64_t GetNativeFieldOffset() const  { return Offset;}
	//uint64_t GetOffset() const { return Offset; }

	uint32_t GetFieldIndex() const { return FieldIndex; }
protected:
	//member variable offset to object 
	uint64_t  Offset;

	//derived class field index is continue from base type
	uint32_t FieldIndex;	
	

};